Is fileExists function not supported by DOORS 9.2?

Is fileExists function not supported by DOORS 9.2. Is there any alternative function for fileExists in DOORS 9.2.

The following error messages is displays in dxl output window while running the dxl in DOORS 9.2. There is no error in DOORS 8.2:

-E- DXL: <Line:453> incorrect argument for (!)
-E- DXL: <Line:453> incorrectly concatenated tokens
-E- DXL: <Line:453> undeclared variable (fileExists)
-E- DXL: <Line:453> incorrect arguments for (if)
-E- DXL: <Line:482> incorrect argument for (!)
-E- DXL: <Line:482> incorrectly concatenated tokens
-E- DXL: <Line:482> undeclared variable (fileExists)
-E- DXL: <Line:482> incorrect arguments for (if)
-E- DXL: <Line:4324> incorrect arguments for (=)
-I- DXL: all done with 9 errors and 0 warnings

Here is code where we get error message...
void Activity_logReport()
{
// create the text file

Stream Activitytext_out_stream
string activityfilename = get(activitylogfileSelectorDBE)
print activityfilename "\n"
if (! FileExists(activityfilename)) //check file exists
{
Activitytext_out_stream = write(activityfilename)
}
else
{
Activitytext_out_stream = append(activityfilename)
Activitytext_out_stream<<"*****************************************************************************************\n"
}
// write to the file
string name= "User Name: " doorsname "\n"
string dateinfo = "Report Date: " dateString "\n"
string Activitymsg = stringOf(Activitylog) "\n"
Activitytext_out_stream << name "\n"
Activitytext_out_stream << dateinfo "\n"
Activitytext_out_stream << Activitymsg
// close the file
close(Activitytext_out_stream)
Activitylog = ""
}
faisal.zahidi@boeing.com - Thu Jan 21 23:31:28 EST 2010

Re: Is fileExists function not supported by DOORS 9.2?
ManuelFelger - Fri Jan 22 08:06:17 EST 2010

I always use the canOpenFile-function to do this checking, like this:
 

string fileName = "d:\\nonExistingFile.txt"
 
if (!canOpenFile(fileName, false))
{
    errorBox "cannot open file  '" fileName "'\n"
        halt
}
else
{
        infoBox "can open file '" fileName "'\n"
}

 


But be careful if you use this for logfiles, DXL Help says:
bool canOpenFile(string pathname,
bool forWrite)
"If forWrite is set to true, the file is opened for write and the current contents of the file are cleared."

Regards,
Manuel

 

Re: Is fileExists function not supported by DOORS 9.2?
doors36677 - Fri Jan 22 10:07:09 EST 2010

try fileExists_

Re: Is fileExists function not supported by DOORS 9.2?
faisal.zahidi@boeing.com - Fri Jan 22 14:23:22 EST 2010

The fileExists function needs to be changed to fileExists_. Works great in DOORS 9.2.

Thanks

FZ